--*****EXHIBIT A - DISTINCT IN A QUERY*****

--DECLARE @EmployeeTable TABLE (EmployeeID INT IDENTITY(1,1), FirstName VARCHAR(25), LastName VARCHAR(25))

--INSERT INTO @EmployeeTable(FirstName, LastName) VALUES
--	('Bret', 'Hill'),('Dustin','Lowder'),('Nayana','Patranabish'),('Sunita','Raina'),
--	('Will','Martin'),('Sharon','Bates'),('Kelly','Herald')
--	,('Esmond','Lowder') --SINGLE MATCHES OF COLUMNS DO NOT PRODUCE DISTINCT
--	,('Dustin','Alfredo') --SINGLE MATCHES OF COLUMNS DO NOT PRODUCE DISTINCT,
--	,('Dustin','Lowder') --EXACT MATCHES ARE THROWN OUT


--SELECT FirstName,LastName FROM @EmployeeTable 

--SELECT DISTINCT FirstName,LastName FROM @EmployeeTable

--SELECT FirstName,LastName FROM @EmployeeTable GROUP BY FirstName,LastName 


--*****EXHIBIT B - DISTINCT IN AGGREGATE*****
--DECLARE @SalesTable TABLE (SalesPersonID INT)
--INSERT INTO @SalesTable (SalesPersonID) VALUES (1),(4),(4),(2),(3),(9),(4)

--SELECT * FROM @SalesTable

--SELECT COUNT(DISTINCT SalesPersonID) FROM @SalesTable


--*****EXHIBIT C - PROBLEMS WITH CALCULATIONS AND DISTINCT
--DECLARE @ClaimDetail TABLE (ClaimID INT, BilledAmount MONEY)
--INSERT INTO @ClaimDetail(ClaimID,BilledAmount) VALUES (1,1.00),(2,2.00),(2,2.00)

--SELECT * FROM @ClaimDetail
--SELECT SUM(BilledAmount) FROM @ClaimDetail
--SELECT SUM(DISTINCT BilledAmount) FROM @ClaimDetail
--SELECT DISTINCT * FROM @ClaimDetail

--*****EXHIBIT D - CONSIDERATIONS WITH DISTINCT*****
SELECT DISTINCT M.fullname, REVERSE(M.fullname) FROM plandata_parallel.dbo.member AS M

;WITH
DistinctNames AS
(
	SELECT DISTINCT M.fullname FROM plandata_parallel.dbo.member AS M
)
SELECT
	D.fullname, REVERSE(D.fullname)	
FROM
	DistinctNames AS D







